/*
 * These tests are not written to validate the results returned by the native 
 * libraries (these are assumed to be correct), but to test the interface.
 * That is, that the rountine can be located, data can be passed to them,
 * and that a result is returned.
 */

using System;
using NUnit.Framework;

namespace dnAnalytics.Nli.UnitTests {
	[TestFixture]
	[Category("BLAS")]
	[Category("ATLAS")]
	public class AtlasBlasTest : BlasTest {
		public AtlasBlasTest() {
			blas = Blas.Provider(BlasProvider.Atlas);
		}
	}

	[TestFixture]
	[Category("BLAS")]
	[Category("MKL")]
	public class MklBlasTest : BlasTest {
		public MklBlasTest() {
			blas = Blas.Provider(BlasProvider.Mkl);
		}
	}

	[TestFixture]
	[Category("BLAS")]
	[Category("ACML")]
	[Category("ACMLCVF")]
	public class AcmlBlasTest : BlasTest {
		public AcmlBlasTest() {
			blas = Blas.Provider(BlasProvider.Acml);
		}
	}

	public abstract class BlasTest {
		protected IBlas blas;
		private const float delta = 1e-4f;

		private float[] farray = new float[] {-1.1f, -2.2f, -3.3f, 0f, 1.1f, 2.2f, -4.4f, 5.5f, 6.6f};
		private double[] darray = new double[] {-1.1, -2.2, -3.3, 0, 1.1, 2.2, -4.4, 5.5, 6.6};
		private ComplexFloat[] cfarray = new ComplexFloat[] {-1.1f, -2.2f, -3.3f, 0f, 1.1f, 2.2f, -4.4f, 5.5f, 6.6f};
		private ComplexDouble[] cdarray = new ComplexDouble[] {-1.1, -2.2, -3.3, 0, 1.1, 2.2, -4.4, 5.5, 6.6};

		[Test]
		public void Sdot() {
			float res = blas.Sdot(farray.Length, farray, 1, farray, 1);
			float expected = 0;
			for (int i = 0; i < farray.Length; i++) {
				expected += farray[i]*farray[i];
			}
			Assert.AreEqual(expected, res, delta);
		}

		[Test]
		public void Ddot() {
			double res = blas.Ddot(darray.Length, darray, 1, darray, 1);
			double expected = 0;
			for (int i = 0; i < farray.Length; i++) {
				expected += darray[i]*darray[i];
			}
			Assert.AreEqual(expected, res, delta);
		}

		[Test]
		public void Dsdot() {
			double res = blas.Dsdot(farray.Length, farray, 1, farray, 1);
			double expected = 0;
			for (int i = 0; i < farray.Length; i++) {
				expected += farray[i]*farray[i];
			}
			Assert.AreEqual(expected, res, delta);
		}

		[Test]
		public void Sdsdot() {
			float sb = 1.1f;
			float res = blas.Sdsdot(farray.Length, sb, farray, 1, farray, 1);
			float expected = 0;
			for (int i = 0; i < farray.Length; i++) {
				expected += farray[i]*farray[i];
			}
			expected += sb;
			Assert.AreEqual(expected, res, delta);
		}

		[Test]
		public void Cdotu_sub() {
			ComplexFloat res = blas.Cdotu_sub(cfarray.Length, cfarray, 1, cfarray, 1);
			ComplexFloat expected = 0;
			for (int i = 0; i < cfarray.Length; i++) {
				expected += cfarray[i]*cfarray[i];
			}
			Assert.AreEqual(expected.Real, res.Real, delta);
			Assert.AreEqual(expected.Imaginary, res.Imaginary, delta);
		}

		[Test]
		public void Cdotc_sub() {
			ComplexFloat res = blas.Cdotc_sub(cfarray.Length, cfarray, 1, cfarray, 1);
			ComplexFloat expected = 0;
			for (int i = 0; i < cfarray.Length; i++) {
				expected += cfarray[i]*cfarray[i].Conjugate;
			}
			Assert.AreEqual(expected.Real, res.Real, delta);
			Assert.AreEqual(expected.Imaginary, res.Imaginary, delta);
		}

		[Test]
		public void Zdotu_sub() {
			ComplexDouble res = blas.Zdotu_sub(cdarray.Length, cdarray, 1, cdarray, 1);
			ComplexDouble expected = 0;
			for (int i = 0; i < cdarray.Length; i++) {
				expected += cdarray[i]*cdarray[i];
			}
			Assert.AreEqual(expected.Real, res.Real, delta);
			Assert.AreEqual(expected.Imaginary, res.Imaginary, delta);
		}

		[Test]
		public void Zdotc_sub() {
			ComplexDouble res = blas.Zdotc_sub(cdarray.Length, cdarray, 1, cdarray, 1);
			ComplexDouble expected = 0;
			for (int i = 0; i < cdarray.Length; i++) {
				expected += cdarray[i]*cdarray[i].Conjugate;
			}
			Assert.AreEqual(expected.Real, res.Real, delta);
			Assert.AreEqual(expected.Imaginary, res.Imaginary, delta);
		}

		[Test]
		public void Snrm2() {
			float res = blas.Snrm2(farray.Length, farray, 1);
			float expected = 10.7778f;
			Assert.AreEqual(expected, res, delta);
		}

		[Test]
		public void Dnrm2() {
			double res = blas.Dnrm2(darray.Length, darray, 1);
			double expected = 10.7778;
			Assert.AreEqual(expected, res, delta);
		}

		[Test]
		public void Scnrm2() {
			float res = blas.Scnrm2(cfarray.Length, cfarray, 1);
			float expected = 10.7778f;
			Assert.AreEqual(expected, res, delta);
		}


		[Test]
		public void Dznrm2() {
			double res = blas.Dznrm2(cdarray.Length, cdarray, 1);
			double expected = 10.7778;
			Assert.AreEqual(expected, res, delta);
		}

		[Test]
		public void Sasum() {
			float res = blas.Sasum(farray.Length, farray, 1);
			float expected = 0;
			for (int i = 0; i < farray.Length; i++) {
				expected += Math.Abs(farray[i]);
			}
			Assert.AreEqual(expected, res, delta);
		}

		[Test]
		public void Dasum() {
			double res = blas.Dasum(darray.Length, darray, 1);
			double expected = 0;
			for (int i = 0; i < darray.Length; i++) {
				expected += Math.Abs(darray[i]);
			}
			Assert.AreEqual(expected, res, delta);
		}

		[Test]
		public void Scasum() {
			float res = blas.Scasum(cfarray.Length, cfarray, 1);
			float expected = 0;
			for (int i = 0; i < cfarray.Length; i++) {
				expected += ComplexMath.Absolute(cfarray[i]);
			}
			Assert.AreEqual(expected, res, delta);
		}

		[Test]
		public void Dzasum() {
			double res = blas.Dzasum(cdarray.Length, cdarray, 1);
			double expected = 0;
			for (int i = 0; i < cdarray.Length; i++) {
				expected += ComplexMath.Absolute(cdarray[i]);
			}
			Assert.AreEqual(expected, res, delta);
		}

		[Test]
		public void Isamax() {
			int res = blas.Isamax(farray.Length, farray, 1);
			int expected = 8;
			Assert.AreEqual(expected, res);
		}

		[Test]
		public void Idamax() {
			int res = blas.Idamax(darray.Length, darray, 1);
			int expected = 8;
			Assert.AreEqual(expected, res);
		}

		[Test]
		public void Icamax() {
			int res = blas.Icamax(cfarray.Length, cfarray, 1);
			int expected = 8;
			Assert.AreEqual(expected, res);
		}

		[Test]
		public void Izamax() {
			int res = blas.Izamax(cdarray.Length, cdarray, 1);
			int expected = 8;
			Assert.AreEqual(expected, res);
		}

		[Test]
		public void Sswap() {
			float[] array1 = (float[]) farray.Clone();
			float[] array2 = new float[array1.Length];
			blas.Sswap(array1.Length, array1, 1, array2, 1);
			for (int i = 0; i < array1.Length; i++) {
				Assert.AreEqual(0, array1[i]);
				Assert.AreEqual(farray[i], array2[i], delta);
			}
		}

		[Test]
		public void Dswap() {
			double[] array1 = (double[]) darray.Clone();
			double[] array2 = new double[array1.Length];
			blas.Dswap(array1.Length, array1, 1, array2, 1);
			for (int i = 0; i < array1.Length; i++) {
				Assert.AreEqual(0, array1[i]);
				Assert.AreEqual(darray[i], array2[i], delta);
			}
		}

		[Test]
		public void Cswap() {
			ComplexFloat[] array1 = (ComplexFloat[]) cfarray.Clone();
			ComplexFloat[] array2 = new ComplexFloat[array1.Length];
			blas.Cswap(array1.Length, array1, 1, array2, 1);
			for (int i = 0; i < array1.Length; i++) {
				Assert.AreEqual(0, array1[i].Real);
				Assert.AreEqual(cfarray[i].Real, array2[i].Real, delta);
				Assert.AreEqual(cfarray[i].Imaginary, array2[i].Imaginary, delta);
			}
		}

		[Test]
		public void Zswap() {
			ComplexDouble[] array1 = (ComplexDouble[]) cdarray.Clone();
			ComplexDouble[] array2 = new ComplexDouble[array1.Length];
			blas.Zswap(array1.Length, array1, 1, array2, 1);
			for (int i = 0; i < array1.Length; i++) {
				Assert.AreEqual(0, array1[i].Real);
				Assert.AreEqual(cdarray[i].Real, array2[i].Real, delta);
				Assert.AreEqual(cdarray[i].Imaginary, array2[i].Imaginary, delta);
			}
		}

		[Test]
		public void Scopy() {
			float[] copy = new float[farray.Length];
			blas.Scopy(farray.Length, farray, 1, copy, 1);
			for (int i = 0; i < farray.Length; i++) {
				Assert.AreEqual(farray[i], copy[i], delta);
			}
		}

		[Test]
		public void Dcopy() {
			double[] copy = new double[darray.Length];
			blas.Dcopy(darray.Length, darray, 1, copy, 1);
			for (int i = 0; i < darray.Length; i++) {
				Assert.AreEqual(darray[i], copy[i], delta);
			}
		}

		[Test]
		public void Ccopy() {
			ComplexFloat[] copy = new ComplexFloat[cfarray.Length];
			blas.Ccopy(cfarray.Length, cfarray, 1, copy, 1);
			for (int i = 0; i < cfarray.Length; i++) {
				Assert.AreEqual(cfarray[i].Real, copy[i].Real, delta);
				Assert.AreEqual(cfarray[i].Imaginary, copy[i].Imaginary, delta);
			}
		}

		[Test]
		public void Zcopy() {
			ComplexDouble[] copy = new ComplexDouble[cdarray.Length];
			blas.Zcopy(cdarray.Length, cdarray, 1, copy, 1);
			for (int i = 0; i < cdarray.Length; i++) {
				Assert.AreEqual(cdarray[i].Real, copy[i].Real, delta);
				Assert.AreEqual(cdarray[i].Imaginary, copy[i].Imaginary, delta);
			}
		}

		[Test]
		public void Saxpy() {
			float[] y = (float[]) farray.Clone();
			blas.Saxpy(y.Length, 2, farray, 1, y, 1);
			float expected = 0;
			for (int i = 0; i < y.Length; i++) {
				expected = 2*farray[i] + farray[i];
				Assert.AreEqual(expected, y[i]);
			}
		}

		[Test]
		public void Daxpy() {
			double[] y = (double[]) darray.Clone();
			blas.Daxpy(y.Length, 2, darray, 1, y, 1);
			double expected = 0;
			for (int i = 0; i < y.Length; i++) {
				expected = 2*darray[i] + darray[i];
				Assert.AreEqual(expected, y[i]);
			}
		}

		[Test]
		public void Caxpy() {
			ComplexFloat[] y = (ComplexFloat[]) cfarray.Clone();
			blas.Caxpy(y.Length, 2, cfarray, 1, y, 1);
			ComplexFloat expected = 0;
			for (int i = 0; i < y.Length; i++) {
				expected = 2*cfarray[i] + cfarray[i];
				Assert.AreEqual(expected, y[i]);
			}
		}

		[Test]
		public void Zaxpy() {
			ComplexDouble[] y = (ComplexDouble[]) cdarray.Clone();
			blas.Zaxpy(y.Length, 2, cdarray, 1, y, 1);
			ComplexDouble expected = 0;
			for (int i = 0; i < y.Length; i++) {
				expected = 2*cdarray[i] + cdarray[i];
				Assert.AreEqual(expected, y[i]);
			}
		}

		[Test]
		public void Srotg() {
			float a = 1.1f;
			float b = 2.2f;
			float c;
			float s;
			blas.Srotg(ref a, ref b, out c, out s);
			Assert.AreEqual(2.459675, a, delta);
			Assert.AreEqual(2.236068, b, delta);
			Assert.AreEqual(0.4472136, c, delta);
			Assert.AreEqual(0.8944272, s, delta);
		}

		[Test]
		public void Drotg() {
			double a = 1.1;
			double b = 2.2;
			double c;
			double s;
			blas.Drotg(ref a, ref b, out c, out s);
			Assert.AreEqual(2.459675, a, delta);
			Assert.AreEqual(2.236068, b, delta);
			Assert.AreEqual(0.4472136, c, delta);
			Assert.AreEqual(0.8944272, s, delta);
		}

		[Test]
		public void Crotg() {
			ComplexFloat a = 1.1f;
			ComplexFloat b = 2.2f;
			ComplexFloat c;
			ComplexFloat s;
			blas.Crotg(ref a, ref b, out c, out s);
			Assert.AreEqual(2.459675, a.Real, delta);
			Assert.AreEqual(2.2, b.Real, delta);
			Assert.AreEqual(0.4472136, c.Real, delta);
			Assert.AreEqual(0.8944272, s.Real, delta);
		}

		[Test]
		public void Zrotg() {
			ComplexDouble a = 1.1;
			ComplexDouble b = 2.2;
			ComplexDouble c;
			ComplexDouble s;
			blas.Zrotg(ref a, ref b, out c, out s);
			Assert.AreEqual(2.459675, a.Real, delta);
			Assert.AreEqual(2.2, b.Real, delta);
			Assert.AreEqual(0.4472136, c.Real, delta);
			Assert.AreEqual(0.8944272, s.Real, delta);
		}

		[Test]
		public void Srotmg() {
			float d1 = 0.001f;
			float d2 = 999f;
			float x1 = .01f;
			float y1 = 99f;
			float[] p;
			blas.Srotmg(ref d1, ref d2, ref x1, y1, out p);
			/*Assert.AreEqual(999f, d1, delta);
			Assert.AreEqual(0.001f, d2, delta);
			Assert.AreEqual(99f, x1, delta);
			*/
			Assert.AreEqual(1, p[0], delta);
			Assert.AreEqual(0, p[1], delta);
			Assert.AreEqual(0, p[2], delta);
			Assert.AreEqual(0, p[3], delta);
			Assert.AreEqual(0.0001, p[4], delta);
		}

		[Test]
		public void Drotmg() {
			double d1 = 0.001;
			double d2 = 999;
			double x1 = .01;
			double y1 = 99;
			double[] p;
			blas.Drotmg(ref d1, ref d2, ref x1, y1, out p);
			/*Assert.AreEqual(999, d1, delta);
			Assert.AreEqual(0.001, d2, delta);
			Assert.AreEqual(99, x1, delta);
			*/
			Assert.AreEqual(1, p[0], delta);
			Assert.AreEqual(0, p[1], delta);
			Assert.AreEqual(0, p[2], delta);
			Assert.AreEqual(0, p[3], delta);
			Assert.AreEqual(0.0001, p[4], delta);
		}

		[Test]
		public void Srot() {
			float c = .33f;
			float s = .22f;
			float[] x = (float[]) farray.Clone();
			float[] y = (float[]) farray.Clone();
			blas.Srot(x.Length, x, 1, y, 1, c, s);
			for (int i = 0; i < x.Length; i++) {
				Assert.AreEqual(c*farray[i] + s*farray[i], x[i], delta);
				Assert.AreEqual(c*farray[i] - s*farray[i], y[i], delta);
			}
		}

		[Test]
		public void Drot() {
			double c = .33f;
			double s = .22f;
			double[] x = (double[]) darray.Clone();
			double[] y = (double[]) darray.Clone();
			blas.Drot(x.Length, x, 1, y, 1, c, s);
			for (int i = 0; i < x.Length; i++) {
				Assert.AreEqual(c*darray[i] + s*darray[i], x[i], delta);
				Assert.AreEqual(c*darray[i] - s*darray[i], y[i], delta);
			}
		}

		[Test]
		public void Csrot() {
			float c = .33f;
			float s = .22f;
			ComplexFloat[] x = (ComplexFloat[]) cfarray.Clone();
			ComplexFloat[] y = (ComplexFloat[]) cfarray.Clone();
			blas.Csrot(x.Length, x, 1, y, 1, c, s);
			for (int i = 0; i < x.Length; i++) {
				Assert.AreEqual((c*cfarray[i] + s*cfarray[i]).Real, x[i].Real, delta);
				Assert.AreEqual((c*cfarray[i] - s*cfarray[i]).Real, y[i].Real, delta);
			}
		}

		[Test]
		public void Zdrot() {
			double c = .33f;
			double s = .22f;
			ComplexDouble[] x = (ComplexDouble[]) cdarray.Clone();
			ComplexDouble[] y = (ComplexDouble[]) cdarray.Clone();
			blas.Zdrot(x.Length, x, 1, y, 1, c, s);
			for (int i = 0; i < x.Length; i++) {
				Assert.AreEqual((c*cdarray[i] + s*cdarray[i]).Real, x[i].Real, delta);
				Assert.AreEqual((c*cdarray[i] - s*cdarray[i]).Real, y[i].Real, delta);
			}
		}

		[Test]
		public void Srotm() {
			float[] x = (float[]) farray.Clone();
			float[] y = (float[]) farray.Clone();
			float[] p = new float[] {-2, 1, 0, 0, 1};
			blas.Srotm(x.Length, x, 1, y, 1, p);
			for (int i = 0; i < x.Length; i++) {
				Assert.AreEqual(farray[i], x[i], delta);
				Assert.AreEqual(farray[i], y[i], delta);
			}
		}

		[Test]
		public void Drotm() {
			double[] x = (double[]) darray.Clone();
			double[] y = (double[]) darray.Clone();
			double[] p = new double[] {-2, 1, 0, 0, 1};
			blas.Drotm(x.Length, x, 1, y, 1, p);
			for (int i = 0; i < x.Length; i++) {
				Assert.AreEqual(darray[i], x[i], delta);
				Assert.AreEqual(darray[i], y[i], delta);
			}
		}

		[Test]
		public void Sscal() {
			float[] x = (float[]) farray.Clone();
			blas.Sscal(x.Length, 2, x, 1);
			for (int i = 0; i < x.Length; i++) {
				Assert.AreEqual(2*farray[i], x[i], delta);
			}
		}

		[Test]
		public void Dscal() {
			double[] x = (double[]) darray.Clone();
			blas.Dscal(x.Length, 2, x, 1);
			for (int i = 0; i < x.Length; i++) {
				Assert.AreEqual(2*darray[i], x[i], delta);
			}
		}

		[Test]
		public void Cscal() {
			ComplexFloat[] x = (ComplexFloat[]) cfarray.Clone();
			blas.Cscal(x.Length, 2, x, 1);
			for (int i = 0; i < x.Length; i++) {
				Assert.AreEqual(2*cfarray[i].Real, x[i].Real, delta);
			}
		}

		[Test]
		public void Zscal() {
			ComplexDouble[] x = (ComplexDouble[]) cdarray.Clone();
			blas.Zscal(x.Length, 2, x, 1);
			for (int i = 0; i < x.Length; i++) {
				Assert.AreEqual(2*cdarray[i].Real, x[i].Real, delta);
			}
		}

		[Test]
		public void Csscal() {
			ComplexFloat[] x = (ComplexFloat[]) cfarray.Clone();
			blas.Csscal(x.Length, 2, x, 1);
			for (int i = 0; i < x.Length; i++) {
				Assert.AreEqual(2*cfarray[i].Real, x[i].Real, delta);
			}
		}

		[Test]
		public void Zdscal() {
			ComplexDouble[] x = (ComplexDouble[]) cdarray.Clone();
			blas.Zdscal(x.Length, 2, x, 1);
			for (int i = 0; i < x.Length; i++) {
				Assert.AreEqual(2*cdarray[i].Real, x[i].Real, delta);
			}
		}

		[Test]
		public void Sgemv() {
			float alpha = 2;
			float beta = 3;
			float[] a = new float[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			float[] x = new float[] {1, 1, 1};
			float[] y = new float[] {1, 1, 1};

			blas.Sgemv(BlasOrderType.Column, BlasTransType.Trans, 3, 3, alpha, a, 3, x, 1, beta, y, 1);
			for (int i = 0; i < y.Length; i++) {
				Assert.AreEqual(9, y[i]);
			}
		}

		[Test]
		public void Dgemv() {
			double alpha = 2;
			double beta = 3;
			double[] a = new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			double[] x = new double[] {1, 1, 1};
			double[] y = new double[] {1, 1, 1};

			blas.Dgemv(BlasOrderType.Column, BlasTransType.Trans, 3, 3, alpha, a, 3, x, 1, beta, y, 1);
			for (int i = 0; i < y.Length; i++) {
				Assert.AreEqual(9, y[i]);
			}
		}

		[Test]
		public void Cgemv() {
			ComplexFloat alpha = 2;
			ComplexFloat beta = 3;
			ComplexFloat[] a = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] x = new ComplexFloat[] {1, 1, 1};
			ComplexFloat[] y = new ComplexFloat[] {1, 1, 1};

			blas.Cgemv(BlasOrderType.Column, BlasTransType.Trans, 3, 3, alpha, a, 3, x, 1, beta, y, 1);
			for (int i = 0; i < y.Length; i++) {
				Assert.AreEqual(9, y[i].Real);
			}
		}

		[Test]
		public void Zgemv() {
			ComplexDouble alpha = 2;
			ComplexDouble beta = 3;
			ComplexDouble[] a = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] x = new ComplexDouble[] {1, 1, 1};
			ComplexDouble[] y = new ComplexDouble[] {1, 1, 1};

			blas.Zgemv(BlasOrderType.Column, BlasTransType.Trans, 3, 3, alpha, a, 3, x, 1, beta, y, 1);
			for (int i = 0; i < y.Length; i++) {
				Assert.AreEqual(9, y[i].Real);
			}
		}

		[Test]
		public void Sgbmv() {
			float alpha = 2;
			float beta = 3;
			float[] a = new float[] {1, 1, 1};
			float[] x = new float[] {1, 1, 1};
			float[] y = new float[] {1, 1, 1};

			blas.Sgbmv(BlasOrderType.Column, BlasTransType.NoTrans, 3, 3, 0, 0, alpha, a, 1, x, 1, beta, y, 1);
			for (int i = 0; i < y.Length; i++) {
				Assert.AreEqual(5, y[i]);
			}
		}

		[Test]
		public void Dgbmv() {
			double alpha = 2;
			double beta = 3;
			double[] a = new double[] {1, 1, 1};
			double[] x = new double[] {1, 1, 1};
			double[] y = new double[] {1, 1, 1};

			blas.Dgbmv(BlasOrderType.Column, BlasTransType.NoTrans, 3, 3, 0, 0, alpha, a, 1, x, 1, beta, y, 1);
			for (int i = 0; i < y.Length; i++) {
				Assert.AreEqual(5, y[i]);
			}
		}

		[Test]
		public void Cgbmv() {
			ComplexFloat alpha = 2;
			ComplexFloat beta = 3;
			ComplexFloat[] a = new ComplexFloat[] {1, 1, 1};
			ComplexFloat[] x = new ComplexFloat[] {1, 1, 1};
			ComplexFloat[] y = new ComplexFloat[] {1, 1, 1};

			blas.Cgbmv(BlasOrderType.Column, BlasTransType.NoTrans, 3, 3, 0, 0, alpha, a, 1, x, 1, beta, y, 1);
			for (int i = 0; i < y.Length; i++) {
				Assert.AreEqual(5, y[i].Real);
			}
		}

		[Test]
		public void Zgbmv() {
			ComplexDouble alpha = 2;
			ComplexDouble beta = 3;
			ComplexDouble[] a = new ComplexDouble[] {1, 1, 1};
			ComplexDouble[] x = new ComplexDouble[] {1, 1, 1};
			ComplexDouble[] y = new ComplexDouble[] {1, 1, 1};

			blas.Zgbmv(BlasOrderType.Column, BlasTransType.NoTrans, 3, 3, 0, 0, alpha, a, 1, x, 1, beta, y, 1);
			for (int i = 0; i < y.Length; i++) {
				Assert.AreEqual(5, y[i].Real);
			}
		}

		[Test]
		public void Strmv() {
			float[] a = new float[] {1, 0, 0, 1, 1, 0, 0, 1, 5};
			float[] x = new float[] {1, 1, 1};

			blas.Strmv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, a, 3, x, 1);
			Assert.AreEqual(2, x[0]);
			Assert.AreEqual(2, x[1]);
			Assert.AreEqual(5, x[2]);
		}

		[Test]
		public void Dtrmv() {
			double[] a = new double[] {1, 0, 0, 1, 1, 0, 0, 1, 5};
			double[] x = new double[] {1, 1, 1};

			blas.Dtrmv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, a, 3, x, 1);
			Assert.AreEqual(2, x[0]);
			Assert.AreEqual(2, x[1]);
			Assert.AreEqual(5, x[2]);
		}

		[Test]
		public void Ctrmv() {
			ComplexFloat[] a = new ComplexFloat[] {1, 0, 0, 1, 1, 0, 0, 1, 5};
			ComplexFloat[] x = new ComplexFloat[] {1, 1, 1};

			blas.Ctrmv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, a, 3, x, 1);
			Assert.AreEqual(2, x[0].Real);
			Assert.AreEqual(2, x[1].Real);
			Assert.AreEqual(5, x[2].Real);
		}

		[Test]
		public void Ztrmv() {
			ComplexDouble[] a = new ComplexDouble[] {1, 0, 0, 1, 1, 0, 0, 1, 5};
			ComplexDouble[] x = new ComplexDouble[] {1, 1, 1};

			blas.Ztrmv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, a, 3, x, 1);
			Assert.AreEqual(2, x[0].Real);
			Assert.AreEqual(2, x[1].Real);
			Assert.AreEqual(5, x[2].Real);
		}

		[Test]
		public void Stbmv() {
			float[] a = new float[] {2, 2, 2};
			float[] x = new float[] {1, 1, 1};

			blas.Stbmv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, 0, a, 1, x, 1);
			Assert.AreEqual(2, x[0]);
			Assert.AreEqual(2, x[1]);
			Assert.AreEqual(2, x[2]);
		}

		[Test]
		public void Dtbmv() {
			double[] a = new double[] {2, 2, 2};
			double[] x = new double[] {1, 1, 1};

			blas.Dtbmv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, 0, a, 1, x, 1);
			Assert.AreEqual(2, x[0]);
			Assert.AreEqual(2, x[1]);
			Assert.AreEqual(2, x[2]);
		}

		[Test]
		public void Ctbmv() {
			ComplexFloat[] a = new ComplexFloat[] {2, 2, 2};
			ComplexFloat[] x = new ComplexFloat[] {1, 1, 1};

			blas.Ctbmv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, 0, a, 1, x, 1);
			Assert.AreEqual(2, x[0].Real);
			Assert.AreEqual(2, x[1].Real);
			Assert.AreEqual(2, x[2].Real);
		}

		[Test]
		public void Ztbmv() {
			ComplexDouble[] a = new ComplexDouble[] {2, 2, 2};
			ComplexDouble[] x = new ComplexDouble[] {1, 1, 1};

			blas.Ztbmv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, 0, a, 1, x, 1);
			Assert.AreEqual(2, x[0].Real);
			Assert.AreEqual(2, x[1].Real);
			Assert.AreEqual(2, x[2].Real);
		}

		[Test]
		public void Stpmv() {
			float[] a = new float[] {2, 0, 0, 0, 2, 2};
			float[] x = new float[] {1, 1, 1};

			blas.Stpmv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, a, x, 1);
			Assert.AreEqual(2, x[0]);
			Assert.AreEqual(2, x[1]);
			Assert.AreEqual(2, x[2]);
		}

		[Test]
		public void Dtpmv() {
			double[] a = new double[] {2, 0, 0, 0, 2, 2};
			double[] x = new double[] {1, 1, 1};

			blas.Dtpmv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, a, x, 1);
			Assert.AreEqual(2, x[0]);
			Assert.AreEqual(2, x[1]);
			Assert.AreEqual(2, x[2]);
		}

		[Test]
		public void Ctpmv() {
			ComplexFloat[] a = new ComplexFloat[] {2, 0, 0, 0, 2, 2};
			ComplexFloat[] x = new ComplexFloat[] {1, 1, 1};

			blas.Ctpmv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, a, x, 1);
			Assert.AreEqual(2, x[0].Real);
			Assert.AreEqual(2, x[1].Real);
			Assert.AreEqual(2, x[2].Real);
		}

		[Test]
		public void Ztpmv() {
			ComplexDouble[] a = new ComplexDouble[] {2, 0, 0, 0, 2, 2};
			ComplexDouble[] x = new ComplexDouble[] {1, 1, 1};

			blas.Ztpmv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, a, x, 1);
			Assert.AreEqual(2, x[0].Real);
			Assert.AreEqual(2, x[1].Real);
			Assert.AreEqual(2, x[2].Real);
		}

		[Test]
		public void Strsv() {
			float[] a = new float[] {3, 0, 0, 0, 2, 0, 0, 0, 5};
			float[] x = new float[] {9, 4, 10};

			blas.Strsv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, a, 3, x, 1);
			Assert.AreEqual(3, x[0]);
			Assert.AreEqual(2, x[1]);
			Assert.AreEqual(2, x[2]);
		}

		[Test]
		public void Dtrsv() {
			double[] a = new double[] {3, 0, 0, 0, 2, 0, 0, 0, 5};
			double[] x = new double[] {9, 4, 10};

			blas.Dtrsv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, a, 3, x, 1);
			Assert.AreEqual(3, x[0]);
			Assert.AreEqual(2, x[1]);
			Assert.AreEqual(2, x[2]);
		}

		[Test]
		public void Ctrsv() {
			ComplexFloat[] a = new ComplexFloat[] {3, 0, 0, 0, 2, 0, 0, 0, 5};
			ComplexFloat[] x = new ComplexFloat[] {9, 4, 10};

			blas.Ctrsv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, a, 3, x, 1);
			Assert.AreEqual(3, x[0].Real);
			Assert.AreEqual(2, x[1].Real);
			Assert.AreEqual(2, x[2].Real);
		}

		[Test]
		public void Ztrsv() {
			ComplexDouble[] a = new ComplexDouble[] {3, 0, 0, 0, 2, 0, 0, 0, 5};
			ComplexDouble[] x = new ComplexDouble[] {9, 4, 10};

			blas.Ztrsv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, a, 3, x, 1);
			Assert.AreEqual(3, x[0].Real);
			Assert.AreEqual(2, x[1].Real);
			Assert.AreEqual(2, x[2].Real);
		}

		[Test]
		public void Stbsv() {
			float[] a = new float[] {2, 2, 2};
			float[] x = new float[] {4, 4, 4};

			blas.Stbsv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, 0, a, 1, x, 1);
			Assert.AreEqual(2, x[0]);
			Assert.AreEqual(2, x[1]);
			Assert.AreEqual(2, x[2]);
		}

		[Test]
		public void Dtbsv() {
			double[] a = new double[] {2, 2, 2};
			double[] x = new double[] {4, 4, 4};

			blas.Dtbsv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, 0, a, 1, x, 1);
			Assert.AreEqual(2, x[0]);
			Assert.AreEqual(2, x[1]);
			Assert.AreEqual(2, x[2]);
		}

		[Test]
		public void Ctbsv() {
			ComplexFloat[] a = new ComplexFloat[] {2, 2, 2};
			ComplexFloat[] x = new ComplexFloat[] {4, 4, 4};

			blas.Ctbsv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, 0, a, 1, x, 1);
			Assert.AreEqual(2, x[0].Real);
			Assert.AreEqual(2, x[1].Real);
			Assert.AreEqual(2, x[2].Real);
		}

		[Test]
		public void Ztbsv() {
			ComplexDouble[] a = new ComplexDouble[] {2, 2, 2};
			ComplexDouble[] x = new ComplexDouble[] {4, 4, 4};

			blas.Ztbsv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, 0, a, 1, x, 1);
			Assert.AreEqual(2, x[0].Real);
			Assert.AreEqual(2, x[1].Real);
			Assert.AreEqual(2, x[2].Real);
		}

		[Test]
		public void Stpsv() {
			float[] a = new float[] {2, 0, 2, 0, 0, 2};
			float[] x = new float[] {4, 4, 4};

			blas.Stpsv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, a, x, 1);
			Assert.AreEqual(2, x[0]);
			Assert.AreEqual(2, x[1]);
			Assert.AreEqual(2, x[2]);
		}

		[Test]
		public void Dtpsv() {
			double[] a = new double[] {2, 0, 2, 0, 0, 2};
			double[] x = new double[] {4, 4, 4};

			blas.Dtpsv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, a, x, 1);
			Assert.AreEqual(2, x[0]);
			Assert.AreEqual(2, x[1]);
			Assert.AreEqual(2, x[2]);
		}

		[Test]
		public void Ctpsv() {
			ComplexFloat[] a = new ComplexFloat[] {2, 0, 2, 0, 0, 2};
			ComplexFloat[] x = new ComplexFloat[] {4, 4, 4};

			blas.Ctpsv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, a, x, 1);
			Assert.AreEqual(2, x[0].Real);
			Assert.AreEqual(2, x[1].Real);
			Assert.AreEqual(2, x[2].Real);
		}

		[Test]
		public void Ztpsv() {
			ComplexDouble[] a = new ComplexDouble[] {2, 0, 2, 0, 0, 2};
			ComplexDouble[] x = new ComplexDouble[] {4, 4, 4};

			blas.Ztpsv(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, a, x, 1);
			Assert.AreEqual(2, x[0].Real);
			Assert.AreEqual(2, x[1].Real);
			Assert.AreEqual(2, x[2].Real);
		}

		[Test]
		public void Ssymv() {
			float[] a = new float[] {1, 2, 2, 1, 1, 2, 1, 1, 1};
			float[] x = new float[] {1, 1, 1};
			float[] y = new float[] {1, 1, 1};

			blas.Ssymv(BlasOrderType.Column, BlasUpLoType.Upper, 3, 3, a, 3, x, 1, 2, y, 1);
			Assert.AreEqual(11, y[0]);
			Assert.AreEqual(11, y[1]);
			Assert.AreEqual(11, y[2]);
		}

		[Test]
		public void Dsymv() {
			double[] a = new double[] {1, 2, 2, 1, 1, 2, 1, 1, 1};
			double[] x = new double[] {1, 1, 1};
			double[] y = new double[] {1, 1, 1};

			blas.Dsymv(BlasOrderType.Column, BlasUpLoType.Upper, 3, 3, a, 3, x, 1, 2, y, 1);
			Assert.AreEqual(11, y[0]);
			Assert.AreEqual(11, y[1]);
			Assert.AreEqual(11, y[2]);
		}

		[Test]
		public void Ssbmv() {
			float[] a = new float[] {10, 1, 1, 1, 1, 1};
			float[] x = new float[] {1, 1, 1};
			float[] y = new float[] {1, 1, 1};

			blas.Ssbmv(BlasOrderType.Column, BlasUpLoType.Upper, 3, 1, 3, a, 2, x, 1, 2, y, 1);
			Assert.AreEqual(8, y[0]);
			Assert.AreEqual(11, y[1]);
			Assert.AreEqual(8, y[2]);
		}

		[Test]
		public void Dsbmv() {
			double[] a = new double[] {10, 1, 1, 1, 1, 1};
			double[] x = new double[] {1, 1, 1};
			double[] y = new double[] {1, 1, 1};

			blas.Dsbmv(BlasOrderType.Column, BlasUpLoType.Upper, 3, 1, 3, a, 2, x, 1, 2, y, 1);
			Assert.AreEqual(8, y[0]);
			Assert.AreEqual(11, y[1]);
			Assert.AreEqual(8, y[2]);
		}

		[Test]
		public void Sspmv() {
			float[] a = new float[] {1, 1, 1, 0, 1, 1};
			float[] x = new float[] {1, 1, 1};
			float[] y = new float[] {1, 1, 1};

			blas.Sspmv(BlasOrderType.Column, BlasUpLoType.Upper, 3, 3, a, x, 1, 2, y, 1);
			Assert.AreEqual(8, y[0]);
			Assert.AreEqual(11, y[1]);
			Assert.AreEqual(8, y[2]);
		}

		[Test]
		public void Dspmv() {
			double[] a = new double[] {1, 1, 1, 0, 1, 1};
			double[] x = new double[] {1, 1, 1};
			double[] y = new double[] {1, 1, 1};

			blas.Dspmv(BlasOrderType.Column, BlasUpLoType.Upper, 3, 3, a, x, 1, 2, y, 1);
			Assert.AreEqual(8, y[0]);
			Assert.AreEqual(11, y[1]);
			Assert.AreEqual(8, y[2]);
		}

		[Test]
		public void Sger() {
			float alpha = 2;
			float[] a = new float[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			float[] x = new float[] {1, 1, 1};
			float[] y = new float[] {1, 1, 1};

			blas.Sger(BlasOrderType.Column, 3, 3, alpha, x, 1, y, 1, a, 3);
			for (int i = 0; i < a.Length; i++) {
				Assert.AreEqual(3, a[i]);
			}
		}

		[Test]
		public void Dger() {
			double alpha = 2;
			double[] a = new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			double[] x = new double[] {1, 1, 1};
			double[] y = new double[] {1, 1, 1};

			blas.Dger(BlasOrderType.Column, 3, 3, alpha, x, 1, y, 1, a, 3);
			for (int i = 0; i < a.Length; i++) {
				Assert.AreEqual(3, a[i]);
			}
		}

		[Test]
		public void Cgerc() {
			ComplexFloat alpha = 2;
			ComplexFloat[] a = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] x = new ComplexFloat[] {1, 1, 1};
			ComplexFloat[] y = new ComplexFloat[] {1, 1, 1};

			blas.Cgerc(BlasOrderType.Column, 3, 3, alpha, x, 1, y, 1, a, 3);
			for (int i = 0; i < a.Length; i++) {
				Assert.AreEqual(3, a[i].Real);
			}
		}

		[Test]
		public void Zgerc() {
			ComplexDouble alpha = 2;
			ComplexDouble[] a = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] x = new ComplexDouble[] {1, 1, 1};
			ComplexDouble[] y = new ComplexDouble[] {1, 1, 1};

			blas.Zgerc(BlasOrderType.Column, 3, 3, alpha, x, 1, y, 1, a, 3);
			for (int i = 0; i < a.Length; i++) {
				Assert.AreEqual(3, a[i].Real);
			}
		}

		[Test]
		public void Cgeru() {
			ComplexFloat alpha = 2;
			ComplexFloat[] a = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] x = new ComplexFloat[] {1, 1, 1};
			ComplexFloat[] y = new ComplexFloat[] {1, 1, 1};

			blas.Cgeru(BlasOrderType.Column, 3, 3, alpha, x, 1, y, 1, a, 3);
			for (int i = 0; i < a.Length; i++) {
				Assert.AreEqual(3, a[i].Real);
			}
		}

		[Test]
		public void Zgeru() {
			ComplexDouble alpha = 2;
			ComplexDouble[] a = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] x = new ComplexDouble[] {1, 1, 1};
			ComplexDouble[] y = new ComplexDouble[] {1, 1, 1};

			blas.Zgeru(BlasOrderType.Column, 3, 3, alpha, x, 1, y, 1, a, 3);
			for (int i = 0; i < a.Length; i++) {
				Assert.AreEqual(3, a[i].Real);
			}
		}

		[Test]
		public void Chbmv() {
			ComplexFloat alpha = 2;
			ComplexFloat beta = 3;

			ComplexFloat[] a = new ComplexFloat[] {2, 2, 2};
			ComplexFloat[] x = new ComplexFloat[] {1, 1, 1};
			ComplexFloat[] y = new ComplexFloat[] {1, 1, 1};

			blas.Chbmv(BlasOrderType.Column, BlasUpLoType.Upper, 3, 0, alpha, a, 1, x, 1, beta, y, 1);
			Assert.AreEqual(7, y[0].Real);
			Assert.AreEqual(7, y[1].Real);
			Assert.AreEqual(7, y[2].Real);
		}

		[Test]
		public void Zhbmv() {
			ComplexDouble alpha = 2;
			ComplexDouble beta = 3;

			ComplexDouble[] a = new ComplexDouble[] {2, 2, 2};
			ComplexDouble[] x = new ComplexDouble[] {1, 1, 1};
			ComplexDouble[] y = new ComplexDouble[] {1, 1, 1};

			blas.Zhbmv(BlasOrderType.Column, BlasUpLoType.Upper, 3, 0, alpha, a, 1, x, 1, beta, y, 1);
			Assert.AreEqual(7, y[0].Real);
			Assert.AreEqual(7, y[1].Real);
			Assert.AreEqual(7, y[2].Real);
		}

		[Test]
		public void Chemv() {
			ComplexFloat alpha = 2;
			ComplexFloat beta = 3;

			ComplexFloat[] a = new ComplexFloat[] {2, 0, 0, 2, 2, 0, 2, 2, 2};
			ComplexFloat[] x = new ComplexFloat[] {1, 1, 1};
			ComplexFloat[] y = new ComplexFloat[] {1, 1, 1};

			blas.Chemv(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, a, 3, x, 1, beta, y, 1);
			Assert.AreEqual(15, y[0].Real);
			Assert.AreEqual(15, y[1].Real);
			Assert.AreEqual(15, y[2].Real);
		}

		[Test]
		public void Zhemv() {
			ComplexDouble alpha = 2;
			ComplexDouble beta = 3;

			ComplexDouble[] a = new ComplexDouble[] {2, 0, 0, 2, 2, 0, 2, 2, 2};
			ComplexDouble[] x = new ComplexDouble[] {1, 1, 1};
			ComplexDouble[] y = new ComplexDouble[] {1, 1, 1};

			blas.Zhemv(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, a, 3, x, 1, beta, y, 1);
			Assert.AreEqual(15, y[0].Real);
			Assert.AreEqual(15, y[1].Real);
			Assert.AreEqual(15, y[2].Real);
		}

		[Test]
		public void Cher() {
			float alpha = 2;
			ComplexFloat[] a = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] x = new ComplexFloat[] {1, 1, 1};

			blas.Cher(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, x, 1, a, 3);
			Assert.AreEqual(3, a[0].Real);
			Assert.AreEqual(1, a[1].Real);
			Assert.AreEqual(1, a[2].Real);
			Assert.AreEqual(3, a[3].Real);
			Assert.AreEqual(3, a[4].Real);
			Assert.AreEqual(1, a[5].Real);
			Assert.AreEqual(3, a[6].Real);
			Assert.AreEqual(3, a[7].Real);
			Assert.AreEqual(3, a[8].Real);
		}

		[Test]
		public void Zher() {
			double alpha = 2.0;
			ComplexDouble[] a = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] x = new ComplexDouble[] {1, 1, 1};

			blas.Zher(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, x, 1, a, 3);
			Assert.AreEqual(3, a[0].Real);
			Assert.AreEqual(1, a[1].Real);
			Assert.AreEqual(1, a[2].Real);
			Assert.AreEqual(3, a[3].Real);
			Assert.AreEqual(3, a[4].Real);
			Assert.AreEqual(1, a[5].Real);
			Assert.AreEqual(3, a[6].Real);
			Assert.AreEqual(3, a[7].Real);
			Assert.AreEqual(3, a[8].Real);
		}

		[Test]
		public void Cher2() {
			ComplexFloat alpha = 2;
			ComplexFloat[] a = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] x = new ComplexFloat[] {1, 1, 1};
			ComplexFloat[] y = new ComplexFloat[] {1, 1, 1};

			blas.Cher2(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, x, 1, y, 1, a, 3);
			Assert.AreEqual(5, a[0].Real);
			Assert.AreEqual(1, a[1].Real);
			Assert.AreEqual(1, a[2].Real);
			Assert.AreEqual(5, a[3].Real);
			Assert.AreEqual(5, a[4].Real);
			Assert.AreEqual(1, a[5].Real);
			Assert.AreEqual(5, a[6].Real);
			Assert.AreEqual(5, a[7].Real);
			Assert.AreEqual(5, a[8].Real);
		}

		[Test]
		public void Zher2() {
			ComplexDouble alpha = 2.0;
			ComplexDouble[] a = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] x = new ComplexDouble[] {1, 1, 1};
			ComplexDouble[] y = new ComplexDouble[] {1, 1, 1};

			blas.Zher2(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, x, 1, y, 1, a, 3);
			Assert.AreEqual(5, a[0].Real);
			Assert.AreEqual(1, a[1].Real);
			Assert.AreEqual(1, a[2].Real);
			Assert.AreEqual(5, a[3].Real);
			Assert.AreEqual(5, a[4].Real);
			Assert.AreEqual(1, a[5].Real);
			Assert.AreEqual(5, a[6].Real);
			Assert.AreEqual(5, a[7].Real);
			Assert.AreEqual(5, a[8].Real);
		}

		[Test]
		public void Chpmv() {
			ComplexFloat alpha = 2;
			ComplexFloat beta = 3;

			ComplexFloat[] a = new ComplexFloat[] {2, 0, 2, 0, 0, 2};
			ComplexFloat[] x = new ComplexFloat[] {1, 1, 1};
			ComplexFloat[] y = new ComplexFloat[] {1, 1, 1};

			blas.Chpmv(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, a, x, 1, beta, y, 1);
			Assert.AreEqual(7, y[0].Real);
			Assert.AreEqual(7, y[1].Real);
			Assert.AreEqual(7, y[2].Real);
		}

		[Test]
		public void Zhpmv() {
			ComplexDouble alpha = 2;
			ComplexDouble beta = 3;

			ComplexDouble[] a = new ComplexDouble[] {2, 0, 2, 0, 0, 2};
			ComplexDouble[] x = new ComplexDouble[] {1, 1, 1};
			ComplexDouble[] y = new ComplexDouble[] {1, 1, 1};

			blas.Zhpmv(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, a, x, 1, beta, y, 1);
			Assert.AreEqual(7, y[0].Real);
			Assert.AreEqual(7, y[1].Real);
			Assert.AreEqual(7, y[2].Real);
		}

		[Test]
		public void Chpr() {
			float alpha = 2;
			ComplexFloat[] a = new ComplexFloat[] {2, 2, 2, 2, 2, 2};
			ComplexFloat[] x = new ComplexFloat[] {1, 1, 1};

			blas.Chpr(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, x, 1, a);
			Assert.AreEqual(4, a[0].Real);
			Assert.AreEqual(4, a[1].Real);
			Assert.AreEqual(4, a[2].Real);
			Assert.AreEqual(4, a[3].Real);
			Assert.AreEqual(4, a[4].Real);
			Assert.AreEqual(4, a[5].Real);
		}

		[Test]
		public void Zhpr() {
			double alpha = 2.0;
			ComplexDouble[] a = new ComplexDouble[] {2, 2, 2, 2, 2, 2};
			ComplexDouble[] x = new ComplexDouble[] {1, 1, 1};

			blas.Zhpr(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, x, 1, a);
			Assert.AreEqual(4, a[0].Real);
			Assert.AreEqual(4, a[1].Real);
			Assert.AreEqual(4, a[2].Real);
			Assert.AreEqual(4, a[3].Real);
			Assert.AreEqual(4, a[4].Real);
			Assert.AreEqual(4, a[5].Real);
		}

		[Test]
		public void Chpr2() {
			ComplexFloat alpha = 2;
			ComplexFloat[] a = new ComplexFloat[] {2, 2, 2, 2, 2, 2};
			ComplexFloat[] x = new ComplexFloat[] {1, 1, 1};
			ComplexFloat[] y = new ComplexFloat[] {1, 1, 1};

			blas.Chpr2(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, x, 1, y, 1, a);
			Assert.AreEqual(6, a[0].Real);
			Assert.AreEqual(6, a[1].Real);
			Assert.AreEqual(6, a[2].Real);
			Assert.AreEqual(6, a[3].Real);
			Assert.AreEqual(6, a[4].Real);
			Assert.AreEqual(6, a[5].Real);
		}

		[Test]
		public void Zhpr2() {
			ComplexDouble alpha = 2.0;
			ComplexDouble[] a = new ComplexDouble[] {2, 2, 2, 2, 2, 2};
			ComplexDouble[] x = new ComplexDouble[] {1, 1, 1};
			ComplexDouble[] y = new ComplexDouble[] {1, 1, 1};

			blas.Zhpr2(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, x, 1, y, 1, a);
			Assert.AreEqual(6, a[0].Real);
			Assert.AreEqual(6, a[1].Real);
			Assert.AreEqual(6, a[2].Real);
			Assert.AreEqual(6, a[3].Real);
			Assert.AreEqual(6, a[4].Real);
			Assert.AreEqual(6, a[5].Real);
		}

		[Test]
		public void Sspr() {
			float alpha = 2;
			float[] a = new float[] {2, 2, 2, 2, 2, 2};
			float[] x = new float[] {1, 1, 1};

			blas.Sspr(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, x, 1, a);
			Assert.AreEqual(4, a[0]);
			Assert.AreEqual(4, a[1]);
			Assert.AreEqual(4, a[2]);
			Assert.AreEqual(4, a[3]);
			Assert.AreEqual(4, a[4]);
			Assert.AreEqual(4, a[5]);
		}

		[Test]
		public void Dspr() {
			double alpha = 2.0;
			double[] a = new double[] {2, 2, 2, 2, 2, 2};
			double[] x = new double[] {1, 1, 1};

			blas.Dspr(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, x, 1, a);
			Assert.AreEqual(4, a[0]);
			Assert.AreEqual(4, a[1]);
			Assert.AreEqual(4, a[2]);
			Assert.AreEqual(4, a[3]);
			Assert.AreEqual(4, a[4]);
			Assert.AreEqual(4, a[5]);
		}

		[Test]
		public void Sspr2() {
			float alpha = 2;
			float[] a = new float[] {2, 2, 2, 2, 2, 2};
			float[] x = new float[] {1, 1, 1};
			float[] y = new float[] {1, 1, 1};

			blas.Sspr2(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, x, 1, y, 1, a);
			Assert.AreEqual(6, a[0]);
			Assert.AreEqual(6, a[1]);
			Assert.AreEqual(6, a[2]);
			Assert.AreEqual(6, a[3]);
			Assert.AreEqual(6, a[4]);
			Assert.AreEqual(6, a[5]);
		}

		[Test]
		public void Dspr2() {
			double alpha = 2.0;
			double[] a = new double[] {2, 2, 2, 2, 2, 2};
			double[] x = new double[] {1, 1, 1};
			double[] y = new double[] {1, 1, 1};

			blas.Dspr2(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, x, 1, y, 1, a);
			Assert.AreEqual(6, a[0]);
			Assert.AreEqual(6, a[1]);
			Assert.AreEqual(6, a[2]);
			Assert.AreEqual(6, a[3]);
			Assert.AreEqual(6, a[4]);
			Assert.AreEqual(6, a[5]);
		}

		[Test]
		public void Ssyr() {
			float alpha = 2;
			float[] a = new float[] {2, 0, 0, 0, 2, 0, 2, 2, 2};
			float[] x = new float[] {1, 1, 1};

			blas.Ssyr(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, x, 1, a, 3);
			Assert.AreEqual(4, a[0]);
			Assert.AreEqual(4, a[4]);
			Assert.AreEqual(4, a[6]);
			Assert.AreEqual(4, a[7]);
			Assert.AreEqual(4, a[8]);
		}

		[Test]
		public void Dsyr() {
			double alpha = 2.0;
			double[] a = new double[] {2, 0, 0, 0, 2, 0, 2, 2, 2};
			double[] x = new double[] {1, 1, 1};

			blas.Dsyr(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, x, 1, a, 3);
			Assert.AreEqual(4, a[0]);
			Assert.AreEqual(4, a[4]);
			Assert.AreEqual(4, a[6]);
			Assert.AreEqual(4, a[7]);
			Assert.AreEqual(4, a[8]);
		}

		[Test]
		public void Ssyr2() {
			float alpha = 2;
			float[] a = new float[] {2, 0, 0, 0, 2, 0, 2, 2, 2};
			float[] x = new float[] {1, 1, 1};
			float[] y = new float[] {1, 1, 1};

			blas.Ssyr2(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, x, 1, y, 1, a, 3);
			Assert.AreEqual(6, a[0]);
			Assert.AreEqual(6, a[4]);
			Assert.AreEqual(6, a[6]);
			Assert.AreEqual(6, a[7]);
			Assert.AreEqual(6, a[8]);
		}

		[Test]
		public void Dsyr2() {
			double alpha = 2.0;
			double[] a = new double[] {2, 0, 0, 0, 2, 0, 2, 2, 2};
			double[] x = new double[] {1, 1, 1};
			double[] y = new double[] {1, 1, 1};

			blas.Dsyr2(BlasOrderType.Column, BlasUpLoType.Upper, 3, alpha, x, 1, y, 1, a, 3);
			Assert.AreEqual(6, a[0]);
			Assert.AreEqual(6, a[4]);
			Assert.AreEqual(6, a[6]);
			Assert.AreEqual(6, a[7]);
			Assert.AreEqual(6, a[8]);
		}

		[Test]
		public void Sgemm() {
			float alpha = 2;
			float beta = 2;
			float[] a = new float[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			float[] b = new float[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			float[] c = new float[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Sgemm(BlasOrderType.Column, BlasTransType.NoTrans, BlasTransType.NoTrans, 3, 3, 3, alpha, a, 3, b, 3, beta, c, 3);
			Assert.AreEqual(8, c[0]);
			Assert.AreEqual(8, c[1]);
			Assert.AreEqual(8, c[2]);
			Assert.AreEqual(8, c[3]);
			Assert.AreEqual(8, c[4]);
			Assert.AreEqual(8, c[5]);
			Assert.AreEqual(8, c[6]);
			Assert.AreEqual(8, c[7]);
			Assert.AreEqual(8, c[8]);
		}

		[Test]
		public void Dgemm() {
			double alpha = 2;
			double beta = 2;
			double[] a = new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			double[] b = new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			double[] c = new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Dgemm(BlasOrderType.Column, BlasTransType.NoTrans, BlasTransType.NoTrans, 3, 3, 3, alpha, a, 3, b, 3, beta, c, 3);
			Assert.AreEqual(8, c[0]);
			Assert.AreEqual(8, c[1]);
			Assert.AreEqual(8, c[2]);
			Assert.AreEqual(8, c[3]);
			Assert.AreEqual(8, c[4]);
			Assert.AreEqual(8, c[5]);
			Assert.AreEqual(8, c[6]);
			Assert.AreEqual(8, c[7]);
			Assert.AreEqual(8, c[8]);
		}

		[Test]
		public void Cgemm() {
			ComplexFloat alpha = 2;
			ComplexFloat beta = 2;
			ComplexFloat[] a = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] b = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] c = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Cgemm(BlasOrderType.Column, BlasTransType.NoTrans, BlasTransType.NoTrans, 3, 3, 3, alpha, a, 3, b, 3, beta, c, 3);
			Assert.AreEqual(8, c[0].Real);
			Assert.AreEqual(8, c[1].Real);
			Assert.AreEqual(8, c[2].Real);
			Assert.AreEqual(8, c[3].Real);
			Assert.AreEqual(8, c[4].Real);
			Assert.AreEqual(8, c[5].Real);
			Assert.AreEqual(8, c[6].Real);
			Assert.AreEqual(8, c[7].Real);
			Assert.AreEqual(8, c[8].Real);
		}

		[Test]
		public void Zgemm() {
			ComplexDouble alpha = 2;
			ComplexDouble beta = 2;
			ComplexDouble[] a = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] b = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] c = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Zgemm(BlasOrderType.Column, BlasTransType.NoTrans, BlasTransType.NoTrans, 3, 3, 3, alpha, a, 3, b, 3, beta, c, 3);
			Assert.AreEqual(8, c[0].Real);
			Assert.AreEqual(8, c[1].Real);
			Assert.AreEqual(8, c[2].Real);
			Assert.AreEqual(8, c[3].Real);
			Assert.AreEqual(8, c[4].Real);
			Assert.AreEqual(8, c[5].Real);
			Assert.AreEqual(8, c[6].Real);
			Assert.AreEqual(8, c[7].Real);
			Assert.AreEqual(8, c[8].Real);
		}

		[Test]
		public void Chemm() {
			ComplexFloat alpha = 2;
			ComplexFloat beta = 2;
			ComplexFloat[] a = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] b = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] c = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Chemm(BlasOrderType.Column, BlasSideType.Left, BlasUpLoType.Upper, 3, 3, alpha, a, 3, b, 3, beta, c, 3);
			Assert.AreEqual(8, c[0].Real);
			Assert.AreEqual(8, c[1].Real);
			Assert.AreEqual(8, c[2].Real);
			Assert.AreEqual(8, c[3].Real);
			Assert.AreEqual(8, c[4].Real);
			Assert.AreEqual(8, c[5].Real);
			Assert.AreEqual(8, c[6].Real);
			Assert.AreEqual(8, c[7].Real);
			Assert.AreEqual(8, c[8].Real);
		}

		[Test]
		public void Zhemm() {
			ComplexDouble alpha = 2;
			ComplexDouble beta = 2;
			ComplexDouble[] a = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] b = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] c = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Zhemm(BlasOrderType.Column, BlasSideType.Left, BlasUpLoType.Upper, 3, 3, alpha, a, 3, b, 3, beta, c, 3);
			Assert.AreEqual(8, c[0].Real);
			Assert.AreEqual(8, c[1].Real);
			Assert.AreEqual(8, c[2].Real);
			Assert.AreEqual(8, c[3].Real);
			Assert.AreEqual(8, c[4].Real);
			Assert.AreEqual(8, c[5].Real);
			Assert.AreEqual(8, c[6].Real);
			Assert.AreEqual(8, c[7].Real);
			Assert.AreEqual(8, c[8].Real);
		}

		[Test]
		public void Cherk() {
			float alpha = 2;
			float beta = 2;
			ComplexFloat[] a = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] c = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Cherk(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, 3, 3, alpha, a, 3, beta, c, 3);
			Assert.AreEqual(8, c[0].Real);
			Assert.AreEqual(1, c[1].Real);
			Assert.AreEqual(1, c[2].Real);
			Assert.AreEqual(8, c[3].Real);
			Assert.AreEqual(8, c[4].Real);
			Assert.AreEqual(1, c[5].Real);
			Assert.AreEqual(8, c[6].Real);
			Assert.AreEqual(8, c[7].Real);
			Assert.AreEqual(8, c[8].Real);
		}

		[Test]
		public void Zherk() {
			double alpha = 2;
			double beta = 2;
			ComplexDouble[] a = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] c = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Zherk(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, 3, 3, alpha, a, 3, beta, c, 3);
			Assert.AreEqual(8, c[0].Real);
			Assert.AreEqual(1, c[1].Real);
			Assert.AreEqual(1, c[2].Real);
			Assert.AreEqual(8, c[3].Real);
			Assert.AreEqual(8, c[4].Real);
			Assert.AreEqual(1, c[5].Real);
			Assert.AreEqual(8, c[6].Real);
			Assert.AreEqual(8, c[7].Real);
			Assert.AreEqual(8, c[8].Real);
		}

		[Test]
		public void Cher2k() {
			float alpha = 2;
			float beta = 2;
			ComplexFloat[] a = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] b = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] c = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Cher2k(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, 3, 3, alpha, a, 3, b, 3, beta, c, 3);
			Assert.AreEqual(14, c[0].Real);
			Assert.AreEqual(1, c[1].Real);
			Assert.AreEqual(1, c[2].Real);
			Assert.AreEqual(14, c[3].Real);
			Assert.AreEqual(14, c[4].Real);
			Assert.AreEqual(1, c[5].Real);
			Assert.AreEqual(14, c[6].Real);
			Assert.AreEqual(14, c[7].Real);
			Assert.AreEqual(14, c[8].Real);
		}

		[Test]
		public void Zher2k() {
			double alpha = 2;
			double beta = 2;
			ComplexDouble[] a = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] b = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] c = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Zher2k(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, 3, 3, alpha, a, 3, b, 3, beta, c, 3);
			Assert.AreEqual(14, c[0].Real);
			Assert.AreEqual(1, c[1].Real);
			Assert.AreEqual(1, c[2].Real);
			Assert.AreEqual(14, c[3].Real);
			Assert.AreEqual(14, c[4].Real);
			Assert.AreEqual(1, c[5].Real);
			Assert.AreEqual(14, c[6].Real);
			Assert.AreEqual(14, c[7].Real);
			Assert.AreEqual(14, c[8].Real);
		}

		[Test]
		public void Ssymm() {
			float alpha = 2;
			float beta = 2;
			float[] a = new float[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			float[] b = new float[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			float[] c = new float[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Ssymm(BlasOrderType.Column, BlasSideType.Left, BlasUpLoType.Upper, 3, 3, alpha, a, 3, b, 3, beta, c, 3);
			Assert.AreEqual(8, c[0]);
			Assert.AreEqual(8, c[1]);
			Assert.AreEqual(8, c[2]);
			Assert.AreEqual(8, c[3]);
			Assert.AreEqual(8, c[4]);
			Assert.AreEqual(8, c[5]);
			Assert.AreEqual(8, c[6]);
			Assert.AreEqual(8, c[7]);
			Assert.AreEqual(8, c[8]);
		}

		[Test]
		public void Dsymm() {
			double alpha = 2;
			double beta = 2;
			double[] a = new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			double[] b = new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			double[] c = new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Dsymm(BlasOrderType.Column, BlasSideType.Left, BlasUpLoType.Upper, 3, 3, alpha, a, 3, b, 3, beta, c, 3);
			Assert.AreEqual(8, c[0]);
			Assert.AreEqual(8, c[1]);
			Assert.AreEqual(8, c[2]);
			Assert.AreEqual(8, c[3]);
			Assert.AreEqual(8, c[4]);
			Assert.AreEqual(8, c[5]);
			Assert.AreEqual(8, c[6]);
			Assert.AreEqual(8, c[7]);
			Assert.AreEqual(8, c[8]);
		}

		[Test]
		public void Csymm() {
			ComplexFloat alpha = 2;
			ComplexFloat beta = 2;
			ComplexFloat[] a = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] b = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] c = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Csymm(BlasOrderType.Column, BlasSideType.Left, BlasUpLoType.Upper, 3, 3, alpha, a, 3, b, 3, beta, c, 3);
			Assert.AreEqual(8, c[0].Real);
			Assert.AreEqual(8, c[1].Real);
			Assert.AreEqual(8, c[2].Real);
			Assert.AreEqual(8, c[3].Real);
			Assert.AreEqual(8, c[4].Real);
			Assert.AreEqual(8, c[5].Real);
			Assert.AreEqual(8, c[6].Real);
			Assert.AreEqual(8, c[7].Real);
			Assert.AreEqual(8, c[8].Real);
		}

		[Test]
		public void Zsymm() {
			ComplexDouble alpha = 2;
			ComplexDouble beta = 2;
			ComplexDouble[] a = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] b = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] c = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Zsymm(BlasOrderType.Column, BlasSideType.Left, BlasUpLoType.Upper, 3, 3, alpha, a, 3, b, 3, beta, c, 3);
			Assert.AreEqual(8, c[0].Real);
			Assert.AreEqual(8, c[1].Real);
			Assert.AreEqual(8, c[2].Real);
			Assert.AreEqual(8, c[3].Real);
			Assert.AreEqual(8, c[4].Real);
			Assert.AreEqual(8, c[5].Real);
			Assert.AreEqual(8, c[6].Real);
			Assert.AreEqual(8, c[7].Real);
			Assert.AreEqual(8, c[8].Real);
		}

		[Test]
		public void Ssyrk() {
			float alpha = 2;
			float beta = 2;
			float[] a = new float[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			float[] c = new float[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Ssyrk(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, 3, 3, alpha, a, 3, beta, c, 3);
			Assert.AreEqual(8, c[0]);
			Assert.AreEqual(1, c[1]);
			Assert.AreEqual(1, c[2]);
			Assert.AreEqual(8, c[3]);
			Assert.AreEqual(8, c[4]);
			Assert.AreEqual(1, c[5]);
			Assert.AreEqual(8, c[6]);
			Assert.AreEqual(8, c[7]);
			Assert.AreEqual(8, c[8]);
		}

		[Test]
		public void Dsyrk() {
			double alpha = 2;
			double beta = 2;
			double[] a = new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			double[] c = new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Dsyrk(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, 3, 3, alpha, a, 3, beta, c, 3);
			Assert.AreEqual(8, c[0]);
			Assert.AreEqual(1, c[1]);
			Assert.AreEqual(1, c[2]);
			Assert.AreEqual(8, c[3]);
			Assert.AreEqual(8, c[4]);
			Assert.AreEqual(1, c[5]);
			Assert.AreEqual(8, c[6]);
			Assert.AreEqual(8, c[7]);
			Assert.AreEqual(8, c[8]);
		}

		[Test]
		public void Csyrk() {
			float alpha = 2;
			float beta = 2;
			ComplexFloat[] a = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] c = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Csyrk(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, 3, 3, alpha, a, 3, beta, c, 3);
			Assert.AreEqual(8, c[0].Real);
			Assert.AreEqual(1, c[1].Real);
			Assert.AreEqual(1, c[2].Real);
			Assert.AreEqual(8, c[3].Real);
			Assert.AreEqual(8, c[4].Real);
			Assert.AreEqual(1, c[5].Real);
			Assert.AreEqual(8, c[6].Real);
			Assert.AreEqual(8, c[7].Real);
			Assert.AreEqual(8, c[8].Real);
		}

		[Test]
		public void Zsyrk() {
			double alpha = 2;
			double beta = 2;
			ComplexDouble[] a = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] c = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Zsyrk(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, 3, 3, alpha, a, 3, beta, c, 3);
			Assert.AreEqual(8, c[0].Real);
			Assert.AreEqual(1, c[1].Real);
			Assert.AreEqual(1, c[2].Real);
			Assert.AreEqual(8, c[3].Real);
			Assert.AreEqual(8, c[4].Real);
			Assert.AreEqual(1, c[5].Real);
			Assert.AreEqual(8, c[6].Real);
			Assert.AreEqual(8, c[7].Real);
			Assert.AreEqual(8, c[8].Real);
		}

		[Test]
		public void Ssyr2k() {
			float alpha = 2;
			float beta = 2;
			float[] a = new float[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			float[] b = new float[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			float[] c = new float[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Ssyr2k(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, 3, 3, alpha, a, 3, b, 3, beta, c, 3);
			Assert.AreEqual(14, c[0]);
			Assert.AreEqual(1, c[1]);
			Assert.AreEqual(1, c[2]);
			Assert.AreEqual(14, c[3]);
			Assert.AreEqual(14, c[4]);
			Assert.AreEqual(1, c[5]);
			Assert.AreEqual(14, c[6]);
			Assert.AreEqual(14, c[7]);
			Assert.AreEqual(14, c[8]);
		}

		[Test]
		public void Dsyr2k() {
			double alpha = 2;
			double beta = 2;
			double[] a = new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			double[] b = new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			double[] c = new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Dsyr2k(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, 3, 3, alpha, a, 3, b, 3, beta, c, 3);
			Assert.AreEqual(14, c[0]);
			Assert.AreEqual(1, c[1]);
			Assert.AreEqual(1, c[2]);
			Assert.AreEqual(14, c[3]);
			Assert.AreEqual(14, c[4]);
			Assert.AreEqual(1, c[5]);
			Assert.AreEqual(14, c[6]);
			Assert.AreEqual(14, c[7]);
			Assert.AreEqual(14, c[8]);
		}

		[Test]
		public void Csyr2k() {
			float alpha = 2;
			float beta = 2;
			ComplexFloat[] a = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] b = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] c = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Csyr2k(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, 3, 3, alpha, a, 3, b, 3, beta, c, 3);
			Assert.AreEqual(14, c[0].Real);
			Assert.AreEqual(1, c[1].Real);
			Assert.AreEqual(1, c[2].Real);
			Assert.AreEqual(14, c[3].Real);
			Assert.AreEqual(14, c[4].Real);
			Assert.AreEqual(1, c[5].Real);
			Assert.AreEqual(14, c[6].Real);
			Assert.AreEqual(14, c[7].Real);
			Assert.AreEqual(14, c[8].Real);
		}

		[Test]
		public void Zsyr2k() {
			double alpha = 2;
			double beta = 2;
			ComplexDouble[] a = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] b = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] c = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Zsyr2k(BlasOrderType.Column, BlasUpLoType.Upper, BlasTransType.NoTrans, 3, 3, alpha, a, 3, b, 3, beta, c, 3);
			Assert.AreEqual(14, c[0].Real);
			Assert.AreEqual(1, c[1].Real);
			Assert.AreEqual(1, c[2].Real);
			Assert.AreEqual(14, c[3].Real);
			Assert.AreEqual(14, c[4].Real);
			Assert.AreEqual(1, c[5].Real);
			Assert.AreEqual(14, c[6].Real);
			Assert.AreEqual(14, c[7].Real);
			Assert.AreEqual(14, c[8].Real);
		}

		[Test]
		public void Strmm() {
			float alpha = 2;
			float[] a = new float[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			float[] b = new float[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Strmm(BlasOrderType.Column, BlasSideType.Left, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, 3, alpha, a, 3, b, 3);
			Assert.AreEqual(6, b[0]);
			Assert.AreEqual(6, b[3]);
			Assert.AreEqual(6, b[6]);
		}

		[Test]
		public void Dtrmm() {
			double alpha = 2;
			double[] a = new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			double[] b = new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Dtrmm(BlasOrderType.Column, BlasSideType.Left, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, 3, alpha, a, 3, b, 3);
			Assert.AreEqual(6, b[0]);
			Assert.AreEqual(6, b[3]);
			Assert.AreEqual(6, b[6]);
		}

		[Test]
		public void Ctrmm() {
			ComplexFloat alpha = 2;
			ComplexFloat[] a = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexFloat[] b = new ComplexFloat[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Ctrmm(BlasOrderType.Column, BlasSideType.Left, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, 3, alpha, a, 3, b, 3);
			Assert.AreEqual(6, b[0].Real);
			Assert.AreEqual(6, b[3].Real);
			Assert.AreEqual(6, b[6].Real);
		}

		[Test]
		public void Ztrmm() {
			ComplexDouble alpha = 2;
			ComplexDouble[] a = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};
			ComplexDouble[] b = new ComplexDouble[] {1, 1, 1, 1, 1, 1, 1, 1, 1};

			blas.Ztrmm(BlasOrderType.Column, BlasSideType.Left, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, 3, alpha, a, 3, b, 3);
			Assert.AreEqual(6, b[0].Real);
			Assert.AreEqual(6, b[3].Real);
			Assert.AreEqual(6, b[6].Real);
		}

		[Test]
		public void Strsm() {
			float alpha = 1;
			float[] a = new float[] {2, 0, 0, 0, 2, 0, 0, 0, 2};
			float[] b = new float[] {10, 10, 10, 10, 10, 10, 10, 10, 10};

			blas.Strsm(BlasOrderType.Column, BlasSideType.Left, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, 3, alpha, a, 3, b, 3);
			Assert.AreEqual(5, b[0]);
			Assert.AreEqual(5, b[1]);
			Assert.AreEqual(5, b[2]);
			Assert.AreEqual(5, b[3]);
			Assert.AreEqual(5, b[4]);
			Assert.AreEqual(5, b[5]);
			Assert.AreEqual(5, b[6]);
			Assert.AreEqual(5, b[7]);
			Assert.AreEqual(5, b[8]);
		}

		[Test]
		public void Dtrsm() {
			double alpha = 1;
			double[] a = new double[] {2, 0, 0, 0, 2, 0, 0, 0, 2};
			double[] b = new double[] {10, 10, 10, 10, 10, 10, 10, 10, 10};

			blas.Dtrsm(BlasOrderType.Column, BlasSideType.Left, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, 3, alpha, a, 3, b, 3);
			Assert.AreEqual(5, b[0]);
			Assert.AreEqual(5, b[1]);
			Assert.AreEqual(5, b[2]);
			Assert.AreEqual(5, b[3]);
			Assert.AreEqual(5, b[4]);
			Assert.AreEqual(5, b[5]);
			Assert.AreEqual(5, b[6]);
			Assert.AreEqual(5, b[7]);
			Assert.AreEqual(5, b[8]);
		}

		[Test]
		public void Ctrsm() {
			ComplexFloat alpha = 1;
			ComplexFloat[] a = new ComplexFloat[] {2, 0, 0, 0, 2, 0, 0, 0, 2};
			ComplexFloat[] b = new ComplexFloat[] {10, 10, 10, 10, 10, 10, 10, 10, 10};

			blas.Ctrsm(BlasOrderType.Column, BlasSideType.Left, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, 3, alpha, a, 3, b, 3);
			Assert.AreEqual(5, b[0].Real);
			Assert.AreEqual(5, b[1].Real);
			Assert.AreEqual(5, b[2].Real);
			Assert.AreEqual(5, b[3].Real);
			Assert.AreEqual(5, b[4].Real);
			Assert.AreEqual(5, b[5].Real);
			Assert.AreEqual(5, b[6].Real);
			Assert.AreEqual(5, b[7].Real);
			Assert.AreEqual(5, b[8].Real);
		}

		[Test]
		public void Ztrsm() {
			ComplexDouble alpha = 1;
			ComplexDouble[] a = new ComplexDouble[] {2, 0, 0, 0, 2, 0, 0, 0, 2};
			ComplexDouble[] b = new ComplexDouble[] {10, 10, 10, 10, 10, 10, 10, 10, 10};

			blas.Ztrsm(BlasOrderType.Column, BlasSideType.Left, BlasUpLoType.Upper, BlasTransType.NoTrans, BlasDiagType.NonUnit, 3, 3, alpha, a, 3, b, 3);
			Assert.AreEqual(5, b[0].Real);
			Assert.AreEqual(5, b[1].Real);
			Assert.AreEqual(5, b[2].Real);
			Assert.AreEqual(5, b[3].Real);
			Assert.AreEqual(5, b[4].Real);
			Assert.AreEqual(5, b[5].Real);
			Assert.AreEqual(5, b[6].Real);
			Assert.AreEqual(5, b[7].Real);
			Assert.AreEqual(5, b[8].Real);
		}


	}
}